﻿using System;
using System.Collections.Generic;
using SharpSqlAnalyzer.nodes;
using SharpSqlAnalyzer.pp.processor.type.comm;
using SharpSqlAnalyzer.stmt;
using SharpSqlAnalyzer.stmt.mssql;

namespace SharpSqlAnalyzer.pp.stmtformatter.type.comm
{
	// Token: 0x02000206 RID: 518
	public class DeclareStmtFormatter : AbstractStmtFormatter
	{
		// Token: 0x0600120E RID: 4622 RVA: 0x00317BF1 File Offset: 0x00315DF1
		public virtual void addVarProcessor(AbstractProcessor p)
		{
			if (this.varProcessors == null)
			{
				this.varProcessors = new List<AbstractProcessor>();
			}
			this.varProcessors.Add(p);
		}

		// Token: 0x0600120F RID: 4623 RVA: 0x00317C14 File Offset: 0x00315E14
		protected internal override void doFormat(TCustomSqlStatement stmtArg)
		{
			TMssqlDeclare tmssqlDeclare = stmtArg as TMssqlDeclare;
			this.runProcessor<TMssqlDeclare>(this.SpecialProcessors, tmssqlDeclare);
			TDeclareVariableList variables = tmssqlDeclare.Variables;
			if (variables != null && variables.size() > 0)
			{
				this.runProcessor<TDeclareVariableList>(this.varProcessors, variables);
			}
			if (tmssqlDeclare.Subquery != null)
			{
				TSelectSqlStatement subquery = tmssqlDeclare.Subquery;
				ExpressionProcessor.processParenthesesNodeInSubQuery(this.Option, subquery, subquery.startToken, subquery.endToken);
			}
		}

		// Token: 0x040013D9 RID: 5081
		private IList<AbstractProcessor> varProcessors;
	}
}
